package com.wct.mall.controller;

import com.wct.mall.common.JsonData;
import com.wct.mall.domain.ValidBean;
import com.wct.mall.service.ValidService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author WEI
 * @date 2020/3/24
 */
@RequestMapping("/valid")
@Controller
public class ValidController {
    @Resource
    private ValidService validService;

    @GetMapping("/test1")
    @ResponseBody
    public JsonData test1(ValidBean param) {
        validService.save1(param);
        return JsonData.success();
    }

    @GetMapping("/test2")
    @ResponseBody
    public JsonData test2(@Valid  ValidBean param) {
        validService.save2(param);
        return JsonData.success();
    }
}
